package com.lmx.repoDomain.tmodel;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ForeignKey;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import io.katharsis.resource.annotations.JsonApiIncludeByDefault;
import io.katharsis.resource.annotations.JsonApiResource;
import io.katharsis.resource.annotations.JsonApiToOne;

/**
 * 
 */
@Entity
@Table(name = "tnb_nursinglevel_serviceitem")
@JsonApiResource(type = "nursinglevelitem")
public class NursingLevelServiceItem extends BaseEntity {

	private NursingLevel level;// 护理等级
	private CustomerServiceItem item;// 服务项目
	private String remark;// 备注
	private String serviceTime;// 服务时长

	private String frequency;// 频次

	private String price;//
	private Dicttype period;// 周期

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@Fetch(FetchMode.JOIN)
	@JoinColumn(name = "period_id", foreignKey = @ForeignKey(name = "null"))
	public Dicttype getPeriod() {
		return period;
	}

	public void setPeriod(Dicttype period) {
		this.period = period;
	}

	@Column(name = "service_time")
	public String getServiceTime() {
		return serviceTime;
	}

	public void setServiceTime(String serviceTime) {
		this.serviceTime = serviceTime;
	}

	@Column(name = "price")
	public String getPrice() {
		return price;
	}

	public void setPrice(String price) {
		this.price = price;
	}

	@Column(name = "frequency")
	public String getFrequency() {
		return frequency;
	}

	public void setFrequency(String frequency) {
		this.frequency = frequency;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
    @Fetch(FetchMode.JOIN)	
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "nursinglevel_id", foreignKey = @ForeignKey(name = "null"))
	public NursingLevel getLevel() {
		return level;
	}

	public void setLevel(NursingLevel level) {
		this.level = level;
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	@JsonApiToOne
	@JsonApiIncludeByDefault
	@Fetch(FetchMode.JOIN)
	@ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	@JoinColumn(name = "serviceitem_id", foreignKey = @ForeignKey(name = "null"))
	public CustomerServiceItem getItem() {
		return item;
	}

	public void setItem(CustomerServiceItem item) {
		this.item = item;
	}

}